import http from "../utils/http"

export default {
    getPress(id, pages) {
        return http({
            url: `/press/${id}`,
            method: 'GET'
        })
    },
    getList(qurey) {
        // console.log(`/press/list?topicId=${datas.topicId}`);
        return http({
            url: `/press/list`,
            method: 'GET',
            params:qurey
        })
    },
    addPress(press) {
        const userInfo = JSON.parse(window.localStorage.getItem("userInfo"))
        press.userId = userInfo.id
        return http({
            url: `/press/add`,
            method: 'post',
            data: press
        })
    },
    addComment(commentData) {
        return http({
            data: commentData,
            url: '/comment/add',
            method: "POST"
        })
    },
    getComment(pressId) {
        return http({
            url: `/comment/list?pressId=${pressId}`,
        })
    },
    updatePress(press) {
        return http({
            url: `/press/update`,
            method: 'post',
            data: press
        })
    },
    getUserPressCount(userId) {
        return http({
            url: `/press/user/${userId}/count`,
            method: 'GET'
        });
    }
}

